package com.inspur.dgov.bsp.application.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.inspur.dgov.bsp.application.entity.PubRole;
import com.inspur.dgov.bsp.application.mapper.TreeMapper;
import com.inspur.dgov.bsp.application.service.TreeService;
import com.inspur.dgov.common.tool.node.TreeNode;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 系统各种树服务实现类
 *
 * @Author chiyupei
 * @Date 19/9/24 上午10:29
 * @Version 1.0
 * @Description 系统各种树服务实现类
 */
@Slf4j
@Service
@AllArgsConstructor
public class TreeServiceImpl extends ServiceImpl<TreeMapper, TreeNode> implements TreeService {

    /**
     * 父级资源
     *
     * @return
     */
    @Override
    public List<TreeNode> resourceParent(Map<String, Object> param) {
        return baseMapper.resourceParent(param);
    }

    /**
     * 父级角色
     *
     * @return
     */
    @Override
    public List<TreeNode> roleParent(Map<String, Object> param) {
        return baseMapper.roleParent(param);
    }

    /**
     * 授权资源
     *
     * @return
     */
    @Override
    public List<TreeNode> grantResource() {
        return baseMapper.grantResource();
    }

    /**
     * 根据角色获取授权资源
     *
     * @return
     */
    @Override
    public List<TreeNode> grantResourceByRole(List<String> list) {
        return baseMapper.grantResourceByRole(list);
    }

    /**
     * 授权角色
     *
     * @return
     */
    @Override
    public List<TreeNode> grantRole(PubRole role) {
        return baseMapper.grantRole(role);
    }
}
